Skip to content

fix: CodeQL alerts#31

Merged
adityathebe merged 1 commit into
mainfrom
fix/codeql-security-alerts
Jul 17, 2026
Merged

fix: CodeQL alerts#31
adityathebe merged 1 commit into
mainfrom
fix/codeql-security-alerts

Conversation

@adityathebe

@adityathebe adityathebe commented Jul 17, 2026

Copy link
Copy Markdown
Member

Summary by CodeRabbit

  • Bug Fixes

    • Improved validation of 1Password references, rejecting malformed formats and unsafe characters before execution.
    • Added checks to ensure the 1Password command-line tool is available before attempting to retrieve secrets.
  • Security

    • Strengthened safeguards around SQL execution and secret reference handling without changing supported query behavior.
  • Maintenance

    • Added automated coverage for valid and invalid 1Password reference formats.

CodeQL continued to flag operator-authored SQL, 1Password CLI arguments, and schema map allocation.

Validate structured op references before invocation, document intentional full-query execution for CodeQL, and avoid overflow-prone capacity arithmetic.
@coderabbitai

coderabbitai Bot commented Jul 17, 2026

Copy link
Copy Markdown

Review Change Stack

Walkthrough

The change adds structured validation for 1Password references with tests, documents intentional execution of complete caller-supplied SQL statements for CodeQL, and removes a map capacity hint in appendUnique.

Changes

1Password reference validation

Layer / File(s) Summary
Validate 1Password references
context/onepassword.go, context/onepassword_test.go
opRead validates parsed op:// references before invoking the CLI, and tests cover accepted and rejected formats.

SQL analysis and schema cleanup

Layer / File(s) Summary
Document SQL execution and map initialization
cmd/query/connections/browser.go, query/providers/sql.go, query/schema/connection.go
CodeQL suppression comments describe complete caller-supplied SQL execution, and appendUnique removes the map capacity hint.

Suggested reviewers: moshloop

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title matches the main goal of the PR, which is addressing CodeQL security alerts.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/codeql-security-alerts
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch fix/codeql-security-alerts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@adityathebe
adityathebe merged commit b2a0d73 into main Jul 17, 2026
12 of 13 checks passed
@adityathebe
adityathebe deleted the fix/codeql-security-alerts branch July 17, 2026 04:04

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
query/schema/connection.go (1)

112-112: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick win

Preserve the map capacity hint unless benchmarks justify removing it.

appendUnique can insert up to len(base)+len(values) keys. Without preallocation, large inputs may require additional map growth and allocations. Retain the hint or add a benchmark demonstrating a real memory improvement.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@query/schema/connection.go` at line 112, Update the map initialization in
appendUnique to preallocate capacity for up to len(base)+len(values) entries,
preserving the existing capacity hint and avoiding unnecessary map growth for
large inputs.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@query/schema/connection.go`:
- Line 112: Update the map initialization in appendUnique to preallocate
capacity for up to len(base)+len(values) entries, preserving the existing
capacity hint and avoiding unnecessary map growth for large inputs.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 0e90a32a-8e6e-4c12-8fc8-3c86ba82dbd5

📥 Commits

Reviewing files that changed from the base of the PR and between 4e01e0f and 6e3b05d.

📒 Files selected for processing (5)
  • cmd/query/connections/browser.go
  • context/onepassword.go
  • context/onepassword_test.go
  • query/providers/sql.go
  • query/schema/connection.go

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant